Long-term tax on capital gains arising from selling a house can be invested in another property under Section 54.
Before applying for a home loan, make sure you have not been delinquent in the past six months at least.